package com.trembear.carclient;

import com.zuche.framework.common.SpringApplicationContext;
import com.zuche.framework.remote.StartLoadRemoteService;
import com.zuche.framework.remote.controller.HttpController;
import com.zuche.framework.remote.nio.client.TcpRemoteClientInternal;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
public class CarclientApplication {

    public static void main(String[] args) {
        ApplicationContext ac=SpringApplication.run(CarclientApplication.class, args);
        SpringApplicationContext.initApplicationContext(ac);
        SpringApplicationContext.initMvcApplicationContext(ac);
        String[] beans=ac.getBeanDefinitionNames();
        for (String beanName : beans) {
            Class<?> beanType = ac.getType(beanName);
            System.out.println("BeanName:" + beanName);
            System.out.println("Bean的类型：" + beanType);
            System.out.println("Bean所在的包：" + beanType.getPackage());
//            System.out.println("Bean：" + ac.getBean(beanName));
        }
//        HttpController hc=new HttpController();
//        SpringApplicationContext.initApplicationContext(ac);
        System.out.println("Bean：" + ac.getBean("remote.controller"));
        System.out.println("Bean：" + ac.getBean("remote.tcpRemoteClientInternal"));
        StartLoadRemoteService startLoadRemoteService=new StartLoadRemoteService();
        startLoadRemoteService.loadServices();
        TcpRemoteClientInternal o= (TcpRemoteClientInternal) SpringApplicationContext.getBean("remote.tcpRemoteClientInternal");
    }
}
